package com.yycx.module.bus.provider.controller;

import com.yycx.common.mybatis.model.ResultBody;
import com.yycx.common.springmvc.base.BaseController;
import com.yycx.module.bus.client.entity.BusInvoiceunit;
import com.yycx.module.bus.provider.service.BusInvoiceunitService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.Map;


/**
 * 开票单位控制器
 *
 * @author flyme
 * @date 2020-08-02
 */
@RestController
@RequestMapping("/bus/invoiceunit/")
public class BusInvoiceunitController extends BaseController<BusInvoiceunitService, BusInvoiceunit> {

    @ApiOperation(value = "开票单位-分页列表", notes = "开票单位分页列表")
    @GetMapping(value = "page")
    public ResultBody pageList(@RequestParam(required = false) Map params) {
        //init();
        return bizService.pageList(params);
    }

    @ApiOperation(value = "开票单位-列表", notes = "开票单位列表")
    @GetMapping(value = "list")
    public ResultBody list(@RequestParam(required = false) Map params) {
        return bizService.listEntityMap(params);
    }

    @ApiOperation(value = "开票单位-添加", notes = "添加开票单位")
    @PostMapping(value = "save")
    public ResultBody save(@RequestParam(required = false) Map params) {
        return bizService.add(params);
    }

    @ApiOperation(value = "开票单位-更新", notes = "更新开票单位")
    @PostMapping(value = "update")
    public ResultBody update(@RequestParam(required = false) Map params) {
        return bizService.edit(params);
    }

    @ApiOperation(value = "开票单位-删除", notes = "删除开票单位")
    @PostMapping(value = "remove")
    public ResultBody remove(@RequestParam(required = false) Map params) {
        return bizService.delete(params);
    }


    @ApiOperation(value = "开票单位-详情", notes = "开票单位详情")
    @GetMapping(value = "get")
    public ResultBody get(@RequestParam(required = false) Map params) {
        return bizService.get(params);
    }

    @ApiOperation(value = "设置状态", notes = "设置状态")
    @PostMapping(value = "setState")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "ids", required = true, value = "主键", paramType = "form"),
        @ApiImplicitParam(name = "invoiceunitState", required = true, value = "状态值", paramType = "form")
    })
    public ResultBody setState(@RequestParam(required = false) Map map, @RequestParam(value = "invoiceunitState") Integer invoiceunitState) {
        return bizService.setState(map, "invoiceunitState", invoiceunitState);
    }


    @ApiOperation(value = "开票单位-批量设置当月额度", notes = "批量设置当月额度")
    @PostMapping(value = "setMonthQuota")
    public ResultBody setMonthQuota(@RequestParam(required = false) Map params) {
        return bizService.setMonthQuota(params);
    }

}
